package com.yunshang.shoppingmall.service.impl;

import com.yunshang.shoppingmall.entity.ActiveProduct;
import com.yunshang.shoppingmall.entity.OrderDetails;
import com.yunshang.shoppingmall.entity.OrderDetailsProduct;
import com.yunshang.shoppingmall.mapper.OrderDetailsMapper;
import com.yunshang.shoppingmall.service.OrderDetailsService;
import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("OrderDetailsService")
public class OrderDetailsServiceImpl implements OrderDetailsService {
    @Autowired
    OrderDetailsMapper orderDetailsMapper;
    @Override
    public OrderDetails selectOrderDetailsByOrderNo(String orderNo,String userId) {
        return orderDetailsMapper.selectOrderDetailsByOrderNo(orderNo,userId);
    }

    @Override
    public List<OrderDetailsProduct> selectOrderDetailsProductByOrderNo(String orderNo) {
        return orderDetailsMapper.selectOrderDetailsProductByOrderNo(orderNo);
    }

    @Override
    public List<OrderDetailsProduct> selectProductDetailsByCartID(@Param("carts") List<String> carts) {
        return  orderDetailsMapper.selectProductDetailsByCartID(carts);
    }

    @Override
    public List<OrderDetailsProduct> selectCartByUserID(int userId) {
        return orderDetailsMapper.selectCartByUserID(userId);
    }

    @Override
    public List<OrderDetailsProduct> selectCart(@Param("userId") String userId,@Param("cartsList") List<String> cartsList) {
        return orderDetailsMapper.selectCart(userId,cartsList);
    }

    @Override
    public OrderDetailsProduct selectCartOne(int userId, int cartId) {
        return orderDetailsMapper.selectCartOne(userId,cartId);
    }

    @Override
    public List<OrderDetailsProduct> selectActiveProductCount(ActiveProduct activeProduct) {
        return orderDetailsMapper.selectActiveProductCount(activeProduct);
    }

    @Override
    public int selectActiveProductTotalCount(ActiveProduct activeProduct) {
        return orderDetailsMapper.selectActiveProductTotalCount(activeProduct);
    }

}
